﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace INSE6260.OnlineBanking.Model.Transaction
{
    public class Deposit : Transaction
    {

        public override void PerformTransaction()
        {
            if (SourceAccount == null)
            {
                throw new Exception("Invalid Source Account");
            }

            if (DestinationAccount == null)
                throw new Exception("Invalid Destination Account");

            if (Amount == 0)
                throw new Exception("Amount is 0");

            SourceAccount.AvailableBalance -= Amount;
            DestinationAccount.AvailableBalance += Amount;

        }
    }
}
